<?php 
	$total = 0;
?>
<div class="order-summary-orders">
	<div class="order-summary-row order-summary-row-header">
		<div class="order-summary-col1">Product name</div>
		<div class="order-summary-col2">Qty.</div>
		<div class="order-summary-col3">Price</div>
		<div class="clear-both"></div>
	</div>
	<?php 
		if (!empty($this->display['products'])):
			foreach ($this->display['products'] as $product): 
			?>
			<div class="order-summary-row order-product">
				<input type="hidden" id="product_id" value="<?php echo $product->getProduct()->getProductId(); ?>" />
				<div class="order-summary-col1 order_product_name">
					<span><?php echo $product->getProduct()->getProductName(); ?></span>
					<span class="order_product_edit">
						<a href="#" class="edit_product">Edit</a> / <a href="#" class="delete_product">Remove</a>
					</span>
				</div>
				<div class="order-summary-col2"><?php echo $product->getProductQty(); ?></div>
				<div class="order-summary-col3"><?php echo $product->getTotalPrice(); ?></div>
				<div class="clear-both"></div>
			</div>
			<?php
				$total += $product->getTotalPrice();
			endforeach;
			
			$total = number_format($total, 2, '.', '');
			
		endif;
	?>
</div>
<div class="order-summary-total">
	<div class="order-summary-total-left">TOTAL</div>
	<div class="order-summary-total-right"><?php echo $total; ?></div>
	<div class="clear-both"></div>
</div>
<script>
$(function () {
	$('.edit_product').click(function () {
		var $elem = $(this);
		var product_id = $($elem).parent().parent().prev().val();
		
		getProductInfo(product_id);
	});

	$('.delete_product').click(function () {
		var $elem = $(this);
		var product_id = $($elem).parent().parent().prev().val();

		deleteProduct(product_id);
	});
		

	$( ".button-jquery-ui" )
		 .button()
		 .click(function( event ) {
		 event.preventDefault();
	});
});
</script>